package com.hk.userservice.model.es;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.stereotype.Component;

import java.io.Serializable;

/**
 * @author zhe
 * @Create 2021/7/31/23:14
 * @State 登录日志Es文档
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Component
@Document(indexName = "hk_loginlog")
public class EsLoginLog implements Serializable {

    @Id
    private Integer id;

    @ApiModelProperty("登录账户ID")
    @Field(type = FieldType.Long,index = false)
    private Integer loginId;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String loginName;

    @ApiModelProperty("登录邮箱")
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String email;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String loginIp;

    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    private String gmtCreate;

    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    private String gmtModified;

    @ApiModelProperty("0：在线中 1：已下线")
    @Field(type = FieldType.Long)
    private Integer state;

}
